<?php

/**
 *  @FileComment            [类型分类视图模型]
 *  @ProjectName             项目名称：shopFrame
 *  @FileName                   文件名称：TypeCategoryViewModel.class.php
 *  @Author                       yuerengui <596580041@qq.com>
 *  @Date                          2014-10-15 0:37:44
 *  *
 */
class TypeCategoryViewModel extends ViewModel {

        public $table = 'type';
        public $view = array(
            'type' => array('_type' => 'INNER'),
            'category' => array('_type' => 'INNER', '_on' => '__type__.tid=category.type_tid')
        );

        public function get_all($pid) {
                return $this->where('pid=' . $pid)->all();
        }

        public function get_tid_all($pid, $tid) {
                return $this->where('pid=0 and type_tid=' . $tid)->all();
        }

        public function get_one_data($cid) {
                return $this->where('cid=' . $cid)->find();
        }

}
